const chartsShow_example = [
  {
    module: "财务管理",
    path: "/cw",
    shows: [
      {
        name: "代办工作",
        show: true,
        key: "tableWaitingWork"
      },
      {
        name: "收入来源统计",
        show: true,
        key: "sourceOfMoney"
      },
      {
        name: "采购农具金额",
        show: true,
        key: "farmTools"
      },
      {
        name: "有机产品库存",
        show: true,
        key: "organicProducts"
      },
      {
        name: "蔬菜种植面积统计",
        show: true,
        key: "vegetableArea"
      },
      {
        name: "公司利润统计",
        show: true,
        key: "profits"
      },
      {
        name: "工资比例",
        show: true,
        key: "wage"
      }
    ]
  },
  {
    module: "行政管理",
    path: "/xz",
    shows: [
      { name: "代办工作", show: true, key: "tableWaitingWork" },
      { name: "介绍", show: true, key: "introduce" },
      {
        name: "工作人员学历统计图",
        show: true,
        key: "educationBackground"
      },
      { name: "人事变动统计图", show: true, key: "prsonnelChanges" },
      { name: "后勤人员统计图", show: true, key: "logistics" },
      { name: "公司利润统计", show: true, key: "profits" }
    ]
  },
  {
    module: "销售管理",
    path: "/xs",
    shows: [
      { name: "代办工作", show: true, key: "tableWaitingWork" },
      { name: "精深加工", show: true, key: "processing" },
      { name: "消费类型", show: true, key: "consume" },
      { name: "葡萄酒产量", show: true, key: "wine" },
      { name: "葡萄产量", show: true, key: "grape" },
      { name: "游览类型", show: true, key: "sightseeingType" },
      { name: "销往地区排行", show: true, key: "sales" }
    ]
  }
];

export default {
  state: {
    chartsShow: [],
    userInfo: {}
  },
  mutations: {
    setChartsShow(state, data) {
      state.chartsShow = data;
    },
    setUserInfo(state, data) {
      state.userInfo = data;
    }
  },
  actions: {
    getChartsShow({ commit }) {
      const data = chartsShow_example;
      commit("setChartsShow", data);
    }
  },
  getters: {
    // 根据模块拿取图表显示权限
    getChartsShowByModule: state => module => {
      return state.chartsShow.find(todo => todo.module === module);
    }
  }
};
